
using System.Data.Entity.ModelConfiguration;

namespace OBUCare.Core.Models.Mapping
{
    public class View_OBU_InfoMap : EntityTypeConfiguration<View_OBU_Info>
    {
        public View_OBU_InfoMap()
        {
            // Primary Key
            this.HasKey(t => new { t.VEHICLE_PLATE_NO, t.OBU_NO, t.USER_NO, t.VEHICLE_CLASS });

            // Properties
            this.Property(t => t.SPEC_NAME)
                //.IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.SUPPLIER)
                //.IsRequired()
                .HasMaxLength(200);
            this.Property(t => t.SUPPLIER_ShortName)
                .HasMaxLength(100);

            this.Property(t => t.VEHICLE_PLATE_NO)
                //.IsRequired()
                .HasMaxLength(12);

            this.Property(t => t.OBU_NO)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(16);

            this.Property(t => t.USER_NO)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(14);



            this.Property(t => t.USER_NAME)
                .HasMaxLength(120);

            // Table & Column Mappings
            this.ToTable("View_OBU_Info");
            this.Property(t => t.SPEC_NAME).HasColumnName("SPEC_NAME");
            this.Property(t => t.SUPPLIER).HasColumnName("SUPPLIER");
            this.Property(t => t.SUPPLIER_ShortName).HasColumnName("SUPPLIER_ShortName");
            this.Property(t => t.SUPPLIERS_ID).HasColumnName("SUPPLIERS_ID");
            this.Property(t => t.SPEC_ID).HasColumnName("SPEC_ID");
            this.Property(t => t.VEHICLE_PLATE_NO).HasColumnName("VEHICLE_PLATE_NO");
            this.Property(t => t.OBU_NO).HasColumnName("OBU_NO");
            this.Property(t => t.LAST_OBU_NO).HasColumnName("LAST_OBU_NO");
            this.Property(t => t.USER_NO).HasColumnName("USER_NO");
            this.Property(t => t.VEHICLE_CLASS).HasColumnName("VEHICLE_CLASS");
            this.Property(t => t.VEHICLE_CLASS_NAME).HasColumnName("VEHICLE_CLASS_NAME");
            this.Property(t => t.USER_NAME).HasColumnName("USER_NAME");
            this.Property(t => t.REGISTE_DATE).HasColumnName("REGISTE_DATE");
        }
    }
}
